package com.stone.daoimpl;
import com.stone.dao.IProjectDao;
import com.stone.dao.hibernatebaseimpl.BaseDaoHibernateImpl;
import com.stone.model.Project;
import com.stone.utils.Page;

public class ProjectDao extends BaseDaoHibernateImpl<Project, Long> implements IProjectDao {

	public Page findAllProjects(int pageNo, int pageSize) {
		String queryString = "from Project project order by project.title";
		return this.findByQueryString4Page(queryString, new Object[]{}, pageNo, pageSize);
	}

	public Page findProjectOrderByTitle(int pageno, int pagesize) {
		String queryString = "from Project project order by project.title desc";
		return this.findByQueryString4Page(queryString, new Object[]{}, pageno, pagesize);
	}

	public Page searchProjectOrderByTitle(String title, int pageno, int pagesize) {
		String queryString = "from Project project where project.title like ? order by project.title desc";
		Object[] values = new Object[]{"%"+title+"%"};
		return this.findByQueryString4Page(queryString, values, pageno, pagesize);
	}
	
}
